#※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※
# File Name: gitdown.sh
# Author: GID5564
# Description:
# Created Time: 06/11/23-20:38:12
#※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※
#! /usr/bin/env bash


cur=$(pwd)
d_path=$1
GIT_BRANCH='master'


cd ${d_path}
git reset --hard origin/${GIT_BRANCH}
git pull --rebase --stat origin ${GIT_BRANCH} --allow-unrelated-histories || git rebase --skip
ret=$?
case "$ret" in
	0) ;;
	*)
	    git fetch --depth=2
		git reset --hard
		git pull --rebase --stat --allow-unrelated-histories || git rebase --skip
		ret=$?
		;;
esac
if [[ ${ret} -eq 0 ]];then
    echo -e "\033[42;34m 本地分支${GIT_BRANCH}更新成功! \033[0m"
else
    echo -e "\033[41;30m 本地分支${GIT_BRANCH}更新失败! \033[0m"
fi
cd ${cur}


























